Repository navigation
Conversation
validateStandardFulfillBalancesAndApprovals adds the offered items to the fulfiller's balances before checking consideration, per requirement 2 in its own doc comment: the fulfiller "does not need to own the ERC20 item as it will first be received from the offerer". That only holds when the offer actually reaches the fulfiller. recipientAddress forwards it somewhere else, and the check never sees that value -- fulfillStandardOrder and fulfillAvailableOrders both take recipientAddress but never pass it down. The credit is applied either way. Accepting a bid is where it shows. The offerer bids 10 ERC20 with a 2.5% fee, so the fulfiller receives 10 and settles 0.25 out of it. Hand the proceeds to a third party with recipientAddress and the fee has to come from the fulfiller's own balance instead. With a zero balance the SDK reports no problem and hands back a fulfillment that reverts on transfer with panic 0x11, which says nothing about what went wrong. Only apply the credit when the offer lands with the fulfiller. The zero address means it stays with them, and naming the fulfiller explicitly is the same thing, so both keep the existing behaviour -- checked on chain, that second case really does settle.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #978 +/- ##
==========================================
+ Coverage 98.27% 98.97% +0.69%
==========================================
Files 35 50 +15
Lines 14526 18565 +4039
Branches 660 988 +328
==========================================
+ Hits 14276 18375 +4099
+ Misses 245 183 -62
- Partials 5 7 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
#978 stopped the per-order check crediting the fulfiller with offer items that recipientAddress sends elsewhere. #984 added a batch-wide check in the same release, and it credits the batch's whole offer unconditionally, so the same class of shortfall is still accepted on the batch path. A fulfiller holding 0.3 ERC20 who accepts two bids with a 250bp fee each owes 0.5 with the proceeds forwarded away. Each order passes the per-order check alone, and the batch check clears the total against a credit for 20 ERC20 the fulfiller never receives. It reverts on transfer.
|
Good find, and thank you for tracing it back to requirement 2 in the doc comment rather than just patching the symptom. A validation pass that clears a fulfillment which then reverts with panic 0x11 is about the least useful failure mode available. Keeping the credit when recipientAddress names the fulfiller explicitly is right, and I appreciate that you checked it onchain rather than assuming. Worth noting for later readers that this makes offerItemsLandWithFulfiller slightly more permissive than the existing isRecipientSelf check used to pick the basic fulfill route, which only treats the zero address as self. That is fine, they are answering different questions, but they now differ. The two control tests that pass on main as well are the reason I trust this one. Reverting the source leaves those two green and fails only the third, on "expected promise to be rejected ... but it was fulfilled". This has landed in #985 with seven other contributions from the same day. Closing in favour of that one. One follow-up your change surfaced, for visibility: #984 landed in the same release and added a batch-wide balance check that credits each order's offer unconditionally, with no knowledge of recipientAddress. So the batch path still had the hole you closed on the single-order path. #986 fixes it by reusing your offerItemsLandWithFulfiller helper. |
Symptom
Accepting a bid and forwarding the proceeds with
recipientAddressproduces a fulfillment the SDK is happy with and the chain is not:Nothing in that points at the cause.
Why
validateStandardFulfillBalancesAndApprovalsadds the offered items to the fulfiller's balances before it checks consideration. Requirement 2 in its own doc comment spells out the reasoning — the fulfiller "does not need to own the ERC20 item as it will first be received from the offerer".True, so long as the offer reaches the fulfiller.
recipientAddresssends it elsewhere, and the check never learns that:fulfillStandardOrderandfulfillAvailableOrdersboth acceptrecipientAddress, neither passes it down. The credit gets applied regardless.A bid makes it concrete. Offerer bids 10 ERC20 with a 2.5% fee, so the fulfiller takes in 10 and pays 0.25 back out of it — fine while they keep the proceeds. Send those to a third party and the 0.25 has to come from the fulfiller's own balance. Holding none, they get the revert above instead of a balance error.
Change
Apply the credit only when the offer lands with the fulfiller, and thread
fulfillerAddressdown so the check can tell.The zero address means the offer stays with the fulfiller. Naming the fulfiller explicitly amounts to the same thing — I checked on chain and that case really does settle — so it keeps the credit too, rather than treating any non-zero recipient as a forward.
What still works
Two of the three new tests in
gifting.spec.tspass onmainas well, deliberately — they pin the behaviour this shouldn't disturb:recipientAddressset to the fulfiller's own address → sameThe third, forwarding to a third party with an empty balance, fails on
main(the call is fulfilled rather than rejected) and now raises "The fulfiller does not have the balances needed".Suite 212.